// import com.alibaba.druid.sql.ast.SQLObjectImpl;
// import com.alibaba.druid.sql.ast.SQLPartitionSpec_ptr;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLAlterTableMergePartition.h"
#include "../../visitor/SQLASTVisitor.h"
#include "../SQLPartitionSpec.h"
#include "../../../utils/listTran.h"

SQLAlterTableMergePartition::SQLAlterTableMergePartition(){
  partitions = std::make_shared<std::list<SQLPartitionSpec_ptr>>();
}
  SQLPartitionSpec_list_ptr SQLAlterTableMergePartition::getPartitions()
  {
    return partitions;
  }

  void SQLAlterTableMergePartition::addPartition(SQLPartitionSpec_ptr x)
  {
    if (x != nullptr)
    {
      x->setParent(SharedObject(SQLAlterTableMergePartition));
    }
    this->partitions->push_back(x);
  }

  BOOL_ptr SQLAlterTableMergePartition::isIfExists()
  {
    return ifExists;
  }

  void SQLAlterTableMergePartition::setIfExists(BOOL_ptr ifExists)
  {
    this->ifExists = ifExists;
  }

  // @Override
  void SQLAlterTableMergePartition::accept0(SQLASTVisitor_ptr visitor)
  {
    if (visitor->visit(SharedObject(SQLAlterTableMergePartition)))
    {
      SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLPartitionSpec, SQLObject>(partitions);
      acceptChild(visitor, tmp1);
    }
    visitor->endVisit(SharedObject(SQLAlterTableMergePartition));
  }

  SQLPartitionSpec_ptr SQLAlterTableMergePartition::getOverwritePartition()
  {
    return overwritePartition;
  }

  void SQLAlterTableMergePartition::setOverwritePartition(SQLPartitionSpec_ptr x)
  {
    if (x != nullptr)
    {
      x->setParent(SharedObject(SQLAlterTableMergePartition));
    }
    this->overwritePartition = x;
  }

  BOOL_ptr SQLAlterTableMergePartition::isPurge()
  {
    return purge;
  }

  void SQLAlterTableMergePartition::setPurge(BOOL_ptr purge)
  {
    this->purge = purge;
  }

